package com.wantup.bootorderserviceconsumer.controller;

import common.bean.UserAddress;
import common.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Zhaoluowei
 * @version 1.0
 * @date 2019/4/12 15:18
 */
@RestController
@Slf4j
@RequestMapping(value =  "/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    //查询用户的地址信息的
    @RequestMapping(value = "initOrder")//,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ResponseBody
    public List<UserAddress> initOrder(String userId){
        log.info("参数为 --> "+userId);
        List<UserAddress> userAddresses = orderService.initOrder2(userId);
        return userAddresses;
    }


}
